{% extends "base.html" %}
{% block title %}借阅者管理{% endblock %}
{% block body %}
<div class="container">
<h2>借阅者管理 </h2>
<h3>添加新借阅者 </h3>
<form action="{{ url_for('manage_borrowers') }}" method="post">
{{ form.hidden_tag() }}
<p>
{{ form.name.label }}<br>
{{ form.name(size=32) }}
</p>
<p>
{{ form.contact.label }}<br>
{{ form.contact(size=32) }}
</p>
<button type="submit">添加借阅者 </button>
    </form>
<h3>现有借阅者 </h3>
<table>
<thead>
<tr>
<th>姓名 </th>
<th>联系方式 </th>
<th>已借图书数量 </th>
<th>操作 </th>
</tr>
</thead>
<tbody>
{% for borrower in borrowers %}
<tr>
<td>{{ borrower.name }} </td>
<td>{{ borrower.contact }} </td>
<td>{{ borrower.books_borrowed }} </td>
<td>
<a href="{{ url_for('edit_borrower', borrower_id=borrower.id) }}">编辑</a>
    <form action="{{ url_for('delete_borrower', borrower_id=borrower.id) }}" method="post" style="display: inline;">
        <button type="submit" onclick="return confirm('确认删除这位借阅者？');">删除</button>
    </form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}